<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="field[@type = 'int' and parent::doctype]">
		<xsl:variable name="is_new" select="parent::doctype/@action = 'create'"/>
		<xsl:variable name="document_field" select="../../document[@doctype_name = current()/parent::doctype/@name]/field[@name = current()/@name]"/>
		<div class="field">
			<label class="title_label" for="{@name}">
				<xsl:value-of select="@title"/>
				<xsl:text>:&#160;</xsl:text>
				<xsl:if test="@is_important = 1">
					<span class="star">*</span>
				</xsl:if>
			</label>
			<input id="{@name}" class="string-" type="text" name="{@name}" value="{$document_field}">
				<xsl:if test="@max_length != 0">
					<xsl:attribute name="maxlength">
						<xsl:value-of select="@max_length"/>
					</xsl:attribute>
				</xsl:if>
				<xsl:choose>
					<xsl:when test="../../pass_info/vars/var[@name = current()/@name]">
						<xsl:attribute name="value">
							<xsl:value-of select="../../pass_info/vars/var[@name = current()/@name]"/>
						</xsl:attribute>
					</xsl:when>
					<xsl:when test="$is_new and @default_value != ''">
						<xsl:attribute name="value">
							<xsl:value-of select="@default_value"/>
						</xsl:attribute>
					</xsl:when>
				</xsl:choose>
			</input>
			<xsl:apply-templates mode="dtf_error" select="." />
			<xsl:if test="@comment != ''">
				<div class="comment-">
					<xsl:value-of select="@comment"/>
				</div>
			</xsl:if>
		</div>
	</xsl:template>
</xsl:stylesheet>
